<?php

namespace Sharks\Core\Command;

use Sharks\Core\Cfg\AppConfig;
use Sharks\Core\Http\Routing\RouteControl;
use Sharks\Core\LifeCycle\Event;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

class ModeCommand extends Command {

    protected function configure() {
        $this->setName("app:build")
            ->setDescription("Build all runtime files in app Storage directory")
            ->addArgument("routes", InputArgument::OPTIONAL, "build routes file");
    }

    protected function execute(InputInterface $input, OutputInterface $output) {
        $this->buildEvents();
        $output->writeln("building events done!");

        $this->buildRoutes();
        $output->writeln("building routes done!");

        $this->buildConfigs();
        $output->writeln("building configs done!");
    }

    public function build() {
        $this->buildEvents();
        $this->buildRoutes();
        $this->buildConfigs();
    }

    public function buildRoutes() {
        $routes = RouteControl::routes();
        $middlewars = RouteControl::middlewares();

        // TODO
    }

    public function buildEvents() {
        $events = Event::events();

        // TODO
    }

    public function buildConfigs() {
        AppConfig::configs();
        // TODO
    }


}